﻿using System;

using Microsoft.Xna.Framework.Graphics;

namespace Storyteller.Framework.Graphics
{
	public class Texture : IDisposable
	{
		internal Texture2D Texture2D { get { return texture2d; } }

		public int Width { get { return texture2d.Width; } }
		public int Height { get { return texture2d.Height; } }

		protected Texture()
		{
		}

		public Texture(Texture2D texture2d)
		{
			this.texture2d = texture2d;
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (!disposed)
			{
				if (disposing)
				{
					// dispose of managed resources
				}

				// dispose of unmanaged resources
				if (handleDisposing)
					texture2d.Dispose();

				disposed = true;
			}
		}

		bool disposed = false;

		protected Texture2D texture2d;
		protected bool handleDisposing = false;
	}
}
